<?php if ($this->res):?>
<?php $res = $this->res?>
<div id="material" class="clearfix">
<div class="first_second_level">
<?php foreach ($res as $firstLevel):?>
	<?php if(isset($firstLevel['children']) && count($firstLevel['children'])>0):?>
		<div class="firstLevel"><?=$firstLevel['label']?></div><br/>	
		<?php reset($firstLevel['children']); ?>
		<?php $first=current($firstLevel['children'])?>
		<?php if($first['type']=='folder'):?>
		<?php foreach ($firstLevel['children'] as $secondLevel):?>
			<div class='group'>
				<a rel="<?=$secondLevel['id']?>" class="secondLevel click" href="#"><span><?=$secondLevel['label'] ?></span></a>
				<?php if($secondLevel['info']):?>
					<?php $info=$secondLevel['info'];?>
					<?php require '_more.phtml';?>
				<?php endif; ?>
			</div>
			
			<?php if(isset($secondLevel['children']) && sizeof($secondLevel['children'])>0):?>
				<?php reset($secondLevel['children']); ?>
				<?php $first=current($secondLevel['children'])?>
				<?php if($first['type']=='folder'):?>
					<div class='thirdLevels'>
					<?php foreach ($secondLevel['children'] as $thirdLevel):?>
						<div class='group'>
							<a rel="<?=$thirdLevel['id']?>" class="thirdLevel click" href="#"><span><?=$thirdLevel['label'] ?></span></a>
							<?php if($thirdLevel['info']):?>
								<?php $info=$thirdLevel['info'];?>
								<?php require '_more.phtml';?>
							<?php endif; ?>
						</div>
						<?php if(isset($thirdLevel['children']) && sizeof($thirdLevel['children'])>0):?>
							<div id="warlist_<?=$thirdLevel['id'] ?>" class="list">
							<?php foreach ($thirdLevel['children'] as $image):?>
								<?$images=explode(',', trim($image['images']));?>
								<div class='material-item'>
									<?php if($image['info']):?>
										<?php $info = $image['info'];?>
										<?php require '_more.phtml';?>
									<?php endif;?>
									<a rel="im_<?=$thirdLevel['id'] ?>" class="image popup_simple" title="<?=$image['label'] ?>" href="<?=$this->image_Helper($images[0])->getUrl()?>"  style="background-image: url(<?=$this->image_Helper($images[0])->crop()->resize(100,100)->getUrl()?>);">
									<?=$image['label'] ?>
									</a>	
								</div>	
							<?php endforeach;?>
							</div>
						<?php endif;?>	
					<?php endforeach;?>
					</div>
				<?php endif;?>		
				<?php if($first['type']=='wares'):?>					
				<div id="warlist_<?=$secondLevel['id'] ?>" class="list level2">
					<?php foreach ($secondLevel['children'] as $image):?>
						<?$images=explode(',', trim($image['images']));?>
						<div class='material-item'>
							<?php if($image['info']):?>
								<?php $info = $image['info'];?>
								<?php require '_more.phtml';?>
							<?php endif;?>
							<a rel="im_<?=$secondLevel['id'] ?>" class="image popup_simple" title="<?=$image['label'] ?>" href="<?=$this->image_Helper($images[0])->getUrl()?>"  style="background-image: url(<?=$this->image_Helper($images[0])->crop()->resize(100,100)->getUrl()?>);">
								<?=$image['label'] ?>
							</a>
						</div>	
					<?php endforeach;?>
				</div>
				<?php endif;?>
			<?php endif;?>
		<?php endforeach;?>
		<?php endif;?>
	<?php endif;?>
<?php endforeach;?>
</div>
</div>
<?php endif;?>